package com.lagou.order.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.lagou.entity.UserCourseOrder;
import com.lagou.order.OrderService;
import mapper.OrderDao;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Service
public class OrderServiceImpl implements OrderService {

    @Autowired
    private OrderDao orderDao;


    //保存订单
    @Override
    public void saveOrder(String orderNo, String user_id, String course_id, String activity_course_id, String source_type) {
        orderDao.saveOrder (orderNo,user_id,course_id,activity_course_id,source_type);
    }

    //更新订单
    @Override
    public Integer updateOrder(String orderNo, int status) {

        Integer i = orderDao.updateOrder (orderNo, status);
        return i;
    }

    //删除订单
    @Override
    public Integer deleteOrder(String orderNo) {

        Integer i = orderDao.deleteOrder (orderNo);
        return i;
    }

    //查询我的订单
    @Override
    public List<UserCourseOrder> getOrdersByUserId(String userId) {

        List<UserCourseOrder> orderList = orderDao.getOrdersByUserId (userId);

        return orderList;
    }
}
